var t = require("../../../@babel/runtime/helpers/toConsumableArray"), a = getApp();

Page({
    data: {
        integral: "积分",
        statusValue: 0,
        selectShow: !1,
        selectType: 0,
        record_list: [],
        money_arr: [],
        currentDate: new Date().getTime(),
        maxDate: new Date().getTime(),
        show: !1,
        postDate: "",
        formatter: function(t, a) {
            return "year" === t ? "".concat(a, "年") : "month" === t ? "".concat(a, "月") : a;
        },
        total_page: 0,
        page: 1,
        isLoadMore: !0,
        loading: !1
    },
    onLoad: function(t) {
        this.getData();
        try {
            var a = wx.getStorageSync("integral");
            a && (this.setData({
                integral: a
            }), this.data.integral && wx.setNavigationBarTitle({
                title: this.data.integral + "列表"
            }));
        } catch (t) {}
    },
    showTap: function() {
        this.setData({
            show: !1
        });
    },
    cancel: function() {
        this.setData({
            show: !1
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData(this.data.page) : console.log("没有更多数据");
    },
    onShareAppMessage: function() {},
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.point-activity.Frontend.Modules.Activity.Controllers.receive-records.index");
        a._postNetWork({
            url: e,
            showToastIn: !1,
            data: {
                page_id: 1
            },
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    var o = e.data;
                    t.setData({
                        record_list: o.record_list,
                        total_page: o.record_list.last_page ? o.record_list.last_page : 0,
                        noneShow: !1,
                        money_arr: o.point_arr
                    }), t.data.total_page || t.setData({
                        total_page: 0
                    });
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {}
        });
    },
    _getMoreData: function() {
        var e = this, o = this;
        if (!(o.data.page >= o.data.total_page)) {
            o.setData({
                page: o.data.page + 1
            });
            var r = a.getNetAddresss("plugin.point-activity.Frontend.Modules.Activity.Controllers.receive-records.index");
            a._postNetWork({
                url: r,
                showToastIn: !1,
                data: {
                    page_id: o.data.page
                },
                success: function(a) {
                    var r = a.data;
                    if (1 == r.result) {
                        var n = r.data.record_list.data;
                        for (var i in n) e.data.record_list.data[i] ? e.data.record_list.data[i] = [].concat(t(e.data.record_list.data[i]), t(n[i])) : e.data.record_list.data[i] = n[i];
                        o.setData({
                            loading: !1,
                            record_list: e.data.record_list,
                            money_arr: Object.assign(e.data.money_arr, r.data.point_arr)
                        });
                    } else o.setData({
                        page: o.data.page - 1,
                        loading: !0,
                        isLoadMore: !1
                    });
                },
                fail: function(t) {}
            });
        }
    }
});